﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BioCompEx3
{
    class Edge
    {
        public double dWeight; // The Edge's weight
        public int iTargetNeuronIndex; // A pointing to the target Neuron
        public static Random randomGenerator = new Random((int)DateTime.Now.Ticks); // A random object used to generate the Initial edge value

        //Constructor
        public Edge(int targetNeuronIndex)
        {
            dWeight = generateRandomWeight(); //Generate a random value between -1 and 1
            iTargetNeuronIndex = targetNeuronIndex; // Set the pointing
        }

        //Generates a random number between -1 and 1
        public double generateRandomWeight()
        {       
            double toReturn = randomGenerator.NextDouble(); //Generate a number between 0 and 1 

            if (randomGenerator.NextDouble() > 0.5) //Decide about the value's sign -/+
            {
                return (-toReturn);
            }
            return toReturn;
        }
    }
}
